package com.itheima.d2_collection_nesting;

import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;

/*
      目标：理解集合的嵌套。
      江苏省 = "南京市","扬州市","苏州市“,"无锡市","常州市"
      湖北省 = "武汉市","孝感市","十堰市","宜昌市","鄂州市"
      河北省 = "石家庄市","唐山市", "邢台市", "保定市", "张家口市"
 */
public class Test {
    public static void main(String[] args) {
        HashMap<String, HashSet> cities = new HashMap<>();

        HashSet<String> privince1 = new HashSet<>();
        Collections.addAll(privince1, "南京市","扬州市","苏州市","无锡市", "常州市");
        HashSet<String> privince2 = new HashSet<>();
        Collections.addAll(privince2, "武汉市","孝感市","十堰市","宜昌市","鄂州市");
        HashSet<String> privince3 = new HashSet<>();
        Collections.addAll(privince3, "石家庄市","唐山市", "邢台市", "保定市", "张家口市");


        cities.put("江苏省", privince1);
        cities.put("湖北省", privince2);
        cities.put("河北省", privince3);


        cities.forEach((province, city) -> {
            System.out.print(province + " --> ");
            city.forEach(cell -> {
                System.out.print(cell + "\t");
            });
            System.out.println();
        });
    }
}
